{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">投注记录</li>
            <li >
                <a href="{:url('admin/Tongji/open')}">开奖统计</a></li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form layui-form-pane" action="{:url('admin/tongji/bet_log')}" method="get">
                    <div class="layui-inline">
                        <label class="layui-form-label">查询日期</label>
                        <div class="layui-input-inline">
                            <input type="text" name="publish_time" value="{:date('Y-m-d')}" class="layui-input datetime">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button class="layui-btn">搜索</button>


                        <button class="layui-btn layui-btn-danger ajax-delete " href="{:url('admin/tongji/delete_all')}"  onclick="return false;">清空全部投注记录</button>

                    </div>
                </form>
                <hr>
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>总亏</th>
                        <th><button class="layui-btn layui-btn-small">{$lose_count}</button></th>
                        <th>总盈</th>
                        <th><button class="layui-btn layui-btn-small layui-btn-normal">{$win_count}</button></th>
                    </tr>
                    </thead>
                </table>
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="width: 30px;">ID</th>
                        <th>期数</th>
                        <th>投注人</th>
                        <!--<th>房间ID</th>-->
                        <th>投注时间</th>
                        <th>投注金币</th>
                        <th>投注类型</th>
                        <th>开奖号码</th>
                        <th>投注状态</th>
                        <!--<th>操作</th>-->
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="log_list" item="vo"}
                    <tr>
                        <td>{$vo.bl_id}</td>
                        <td>{$vo.round_turn}</td>
                        <td><a class="layui-btn  layui-btn-small" href="{:url('admin/user/stat',['userid'=> $vo['user_id']])}">{$vo.usernick}</a></td>
                        <!--<td>{$vo.room_uuid}</td>-->
                        <td>{$vo.create_time | date='Y-m-d H:i:s',###}</td>
                        <td>{$vo.bet_amount}</td>
                        <td>{$vo.bet_detail}</td>
                        <td>{$vo.round_result}</td>
                        <td>{$bet_status[$vo['bet_result']]}{if condition="$vo['bet_result'] == 1"}({$vo.bet_res_amount}){/if}</td>

                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                <!--分页-->
                {$log_list->render()}
            </div>
        </div>
    </div>
</div>
<style>
    .layui-table th,td{
        text-align: center;
    }

</style>
{/block}
{block name="script"}
<script>
    $('.mc-ajax').click(function(e){
        e.preventDefault();
        var _action = $(this).attr('href');
        layer.prompt({
            formType: 0,
            value: '0',
            title: '输入增减的数量',
            // area: ['200px', '350px'] //自定义文本域宽高
        }, function(value, index, elem){
            console.log(parseFloat(value))
            if(!value.trim() || !isNaN(parseFloat(value.trim())) == 0){
                layer.msg('请输入大于0的数字');
                return false;
            }
            $.ajax({
                url: _action,
                data: {amount:value},
                success: function (info) {
                    if (info.code === 1) {
                        setTimeout(function () {
                            location.reload()
                        }, 1000);
                    }
                    layer.msg(info.msg);
                }
            });
            // alert(value); //得到value
            layer.close(index);
        });
    });
</script>
{/block}